home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 117
/
FreelogNo117-OctobreNovembre2013.iso
/
Programmation
/
jedit
/
jedit5.1.0install.exe
/
{app}
/
macros
/
Emacs
/
Emacs_Transpose_Chars.bsh
< prev
next >
Wrap
Text File
|
2013-07-28
|
716b
|
28 lines
/**
* Transpose character at caret with previous character, and move caret
* forward one. Emulates Emacs "transpose-chars" command (without prefix
* argument support).
*/
source (MiscUtilities.constructPath(dirname(scriptPath), "EmacsUtil.bsh"));
void emacsTransposeChars()
{
caret = textArea.getCaretPosition();
if ((caret == 0) || atEndOfBuffer())
{
beep();
return;
}
char chCur = charAtCaret();
char chPrev = charAt (caret - 1);
selection = new Selection.Range (caret - 1, caret + 1);
textArea.setSelection (selection);
textArea.setSelectedText (new String ("" + chCur + chPrev));
textArea.removeFromSelection (selection);
}
emacsTransposeChars();